package cn.bone.gateway.dao;

import cn.bone.gateway.bean.ApiMethod;
import org.mongodb.morphia.Datastore;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by superbone on 2017/3/30.
 */
@Repository
public class ApiMethodDao {

    @Resource
    private Datastore datastore;

    public void save(ApiMethod method){
        datastore.save(method);
    }

    public List<ApiMethod> queryUsable(){

        return datastore.createQuery(ApiMethod.class)
                .field("usable").equal(true)
                .asList();
    }
}
